home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3 / CHAPTE25 / EX14.C < prev    next >
C/C++ Source or Header  |  1995-04-23  |  1KB  |  33 lines

  1. #include <genstub.c>
  2.  
  3. // Windows message procedure.
  4. LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  5. {
  6.     switch (uMsg)
  7.     {
  8.             case WM_COMMAND:       /* process menu items */
  9.                     switch ( LOWORD( wParam )  )
  10.                     {
  11.                         case IDM_TEST:  // force a paint to display screen.
  12.                         {
  13.                             TCHAR szBuffer[128];
  14.                             // Show the desktop.
  15.                             HDESK hDesktopObject = GetThreadDesktop( GetCurrentThreadId( ) );
  16.                             wsprintf( szBuffer, "Desktop Object is %x", hDesktopObject );
  17.                             MessageBox( hWnd, szBuffer, "GetThreadDesktop()", MB_OK );
  18.                         }
  19.                         break;
  20.                         case IDM_EXIT:
  21.                               DestroyWindow( hWnd );
  22.                               break;
  23.                     }
  24.                     break;
  25.  
  26.            case WM_DESTROY:
  27.                     PostQuitMessage( 0 );
  28.                     break;
  29.            default:
  30.                  return (DefWindowProc(hWnd, uMsg, wParam, lParam));
  31.     }
  32.     return (NULL);
  33. }